package net.csdn.business.kanban.feign.interceptor;


import feign.RequestInterceptor;
import feign.RequestTemplate;
import net.csdn.business.kanban.common.constant.CommonConstants;
import net.csdn.business.kanban.common.context.AuthContextHolder;
import org.springframework.core.Ordered;

/**
 * @ClassName GitCodeFeignInterceptor
 * @Description TODO
 * @Author zhangyl
 * @Date 2023/8/9 17:17
 */
public class GitCodeFeignInterceptor implements RequestInterceptor, Ordered {
    @Override
    public void apply(RequestTemplate template) {
        template.header(CommonConstants.X_AUTH_TOKEN, AuthContextHolder.getHuaweiToken());
        template.header(CommonConstants.X_UID, AuthContextHolder.getUid());
        template.header(CommonConstants.X_USERNAME, AuthContextHolder.getUsername());
        template.header(CommonConstants.X_IAM_ID, AuthContextHolder.getIamId());
        template.header(CommonConstants.X_CODE_ART_ID, AuthContextHolder.getCodeArtsId());
    }

    @Override
    public int getOrder() {
        return CommonConstants.INT_ZERO;
    }
}